package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.DTO.property.PaymentRecordDTO;
import com.itlong.cloud.POJO.VO.app.AppElevatorMealPayRecordVO;
import com.itlong.cloud.POJO.VO.property.PropertyPaymentRecordVO;
import com.itlong.cloud.paymenthub.IPropertyPaymentServiceClient;
import com.itlong.cloud.property.service.IPropertyPaymentService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      物业缴费管理接口暴露实现类
 * </desc>
 *
 * @createDate2020/7/15
 **/
@RestController
public class PropertyPaymentServiceResource implements IPropertyPaymentServiceClient {

    @Autowired
    private IPropertyPaymentService iPropertyPaymentService;


    /**
     * <desc>
     *      分页查询缴费记录
     * </desc>
     *
     * @param paymentRecordDTO 缴费记录DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/7/15
     */
    @PostMapping("/property/sharedElevator/payment/getPage")
    @Override
    public Page<PropertyPaymentRecordVO> getPage(@RequestBody PaymentRecordDTO paymentRecordDTO) throws Exception {
        return iPropertyPaymentService.getPage(paymentRecordDTO);
    }

    /**
     * <desc>
     *    获取乘梯缴费记录列表
     * </desc>
     *
     * @param projectId 项目编号
     * @param roomId 房间ID
     * @param pageNum 请求页(每页15条)
     * @param consumeTime 缴费记录DTO
     * @return MessageVO 受影响行数
     * @author Qiang.S
     * @createDate 2020/07/16
     */
    @Override
    @PostMapping("/property/sharedElevator/payment/getLiftPayRecord")
    public List<AppElevatorMealPayRecordVO> getLiftPayRecord(@RequestParam("projectId")String projectId, @RequestParam("roomId")String roomId,
                                                    @RequestParam("pageNum")String pageNum, @RequestParam(value = "consumeTime",required = false) String consumeTime) throws Exception {
        return iPropertyPaymentService.getLiftPayRecord(projectId,roomId,pageNum,consumeTime);
    }

    /**
     * <desc>
     *      获取缴费记录总金额
     * </desc>
     *
     * @param paymentRecordDTO 参数实体
     * @return
     * @Author Zhu.yj
     * @createDate  2020/7/20
     */
    @Override
    @PostMapping("/property/elevator/payment/getPaymentPriceCount")
    public String getPaymentPriceCount(@RequestBody PaymentRecordDTO paymentRecordDTO) throws Exception {
        return iPropertyPaymentService.getPaymentPriceCount(paymentRecordDTO);
    }

    /**
     * <desc>
     *      检查活动套餐是否在当前房间使用过
     * </desc>
     *
     * @param mealId 套餐编号
     * @param roomId 房间ID
     * @return
     * @Author Zhu.yj
     * @createDate  2020/7/20
     */
    @Override
    @PostMapping("/property/elevator/payment/checkMealInfo")
    public Integer checkMealInfo(@RequestParam("mealId")String mealId, @RequestParam("roomId")String roomId) throws Exception {
        return iPropertyPaymentService.checkMealInfo(mealId,roomId);
    }

    /**
     * <desc>
     *      检查套餐是否禁用
     * </desc>
     *
     * @param mealId 套餐编号
     * @return
     * @Author Zhu.yj
     * @createDate  2020/7/20
     */
    @Override
    @PostMapping("/property/elevator/payment/checkMealStatus")
    public Integer checkMealStatus(@RequestParam("mealId")String mealId) throws Exception {
        return iPropertyPaymentService.checkMealStatus(mealId);
    }
}
